package com.zjitc.service;

import com.zjitc.common.PageModel;
import com.zjitc.common.ServerResponse;
import com.zjitc.pojo.User;
import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
import javax.servlet.http.HttpSession;

/**
 * Create By IntelliJ IDEA
 *
 * @author:
 * @create-Time: 2017/11/7  15:55
 */
public interface UserService {
  /**
    * 注册
    * @param user
    * @param path
    * @return
    */
  boolean regiser(User user, String path);

  /**
   * 激活
   * @param uid
   * @param code
   * @return
   */
  boolean active(String uid, String code);

  /**
   * 登陆
   * @param username
   * @param password
   * @param verification
   * @param session
   * @return
   * @throws UnsupportedEncodingException
   * @throws NoSuchAlgorithmException
   */
  ServerResponse<User> login(String username, String password, String verification, HttpSession session)
        throws UnsupportedEncodingException, NoSuchAlgorithmException;

  /**
   * 检查用户名是否被占用
   * @param username
   * @return
   */
  ServerResponse<User> checkUsername(String username);

  /**
   * 查看所有用户信息
   * @param pageid
   * @param count
   * @return
   */
  PageModel<User> findall(int pageid, int count);

  /**
   * 更新用户信息
   * @param user
   */
  void update(User user);

  /**
   * 查看用户
   * @param uid
   * @return
   */
  User findbyuid(String uid);

  /**
   * 删除用户
   * @param uid
   */
  void deluser(String uid);

  /**
   * 确认密码
   * @param password
   * @param verifypassword
   * @return
   */
  ServerResponse checkpassword(String password, String verifypassword);

  /**
   * 管理员登陆
   * @param username
   * @param password
   * @return
   */
  User adminLogin(String username, String password);

}
